<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const p1 = new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve('商品数据 - 1');
        }, 1000);
    });

    const p2 = new Promise((resolve, reject) => {
        setTimeout(() => {
            // resolve('商品数据 - 2');
            reject('出错了...')
        }, 1000);
    });

    //两个Promise有一个成功即可
    // var res = Promise.allSettled([p1, p2]);

    //两个Promise必须全部成功才行
    let res = Promise.all([p1, p2]);


    console.log(res);

</script>
</body>
</html>
